<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<nav class="row justify-content-between">
    <div class="col-4">
        当前为第${param.currentPageNo}页，共${param.totalCount}条数据
    </div>
    <ul class="col-4 pagination justify-content-end">
        <li class="page-item ${'1'.equals(param.currentPageNo) ? 'disabled' : '' }">
            <a class="page-link" href="javascript:page_to(${param.currentPageNo-1})">Previous</a>
        </li>
        <%
            int total = 1;
            try {
                total = Integer.parseInt(request.getParameter("totalPageCount"));
            } catch (NumberFormatException ignored) {
            }
            for (int i = 1; i <= total; i++) {
        %>
        <li class="page-item">
            <a class="page-link" href="javascript:page_to(<%=i%>)"><%=i%>
            </a>
        </li>
        <%
            }
        %>
        <li class="page-item ${param.currentPageNo.equals(param.totalPageCount) ? 'disabled' : '' }">
            <a class="page-link" href="javascript:page_to(${param.currentPageNo+1})">Next</a>
        </li>
    </ul>
</nav>
<script>
    function page_to(num, frm = document.forms[0]) {
        frm.pageIndex.value = num;
        frm.submit();
    }
</script>
